package design_principles.proxy.code;

public class DynamicDataSourceEntry {
    private final static String DEFAULT_SOURCE=null;
    private final static ThreadLocal<String> sourceMap=new ThreadLocal<>();

    public static void clear(){
        sourceMap.remove();
    }
    public static String get(){
      return  sourceMap.get();
    }
    public static void restore(){
        sourceMap.set(DEFAULT_SOURCE);
    }
    public static void set(String source){
        sourceMap.set(source);
    }
    public static void set(int year){
        sourceMap.set("DB_"+year);
    }
}